<!doctype html>
<html lang="en">

<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Hello, world!</title>
    <!-- 成品出货 -->
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="../css/font-awesome.min.css">
    <link rel="stylesheet" href="../fonts/iconfont.css">
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <link rel="stylesheet" href="../css/bootstrap-select.min.css">
    <link rel="stylesheet" href="../css/style.css">
    <style>
        .bd-placeholder-img {
            font-size: 1.125rem;
            text-anchor: middle;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }

        @media (min-width: 768px) {
            .bd-placeholder-img-lg {
                font-size: 3.5rem;
            }
        }

        html,
        body {
            height: 100%;
        }

        body {
            padding-bottom: 40px;
            background-color: #fff;
        }
        .nav-tabs {
            position: sticky;
            top: 0;
            padding-top: 10px;
            z-index: 999;
            background-color: #fff;
        }

        .form-signin {
            width: 100%;
            max-width: 640px;
            margin: auto;
            padding: 15px;
        }
        .wareContent{
            display: flex;
            justify-content: center;
            align-items: center;
            position: relative;
        }
        .form-signin .checkbox {
            font-weight: 400;
        }

        .form-signin .form-control {
            position: relative;
            box-sizing: border-box;
            height: auto;
            padding: 10px;
            font-size: 16px;
        }

        .form-signin .form-control:focus {
            z-index: 2;
        }

        .form-signin input[type="email"] {
            margin-bottom: -1px;
            border-bottom-right-radius: 0;
            border-bottom-left-radius: 0;
        }

        .form-signin input[type="password"] {
            margin-bottom: 10px;
            border-top-left-radius: 0;
            border-top-right-radius: 0;
        }

        .sr-only2 {
            margin-top: 15px;
        }


        .logodiv img {
            width: 240px;
            margin: 0 auto;
            display: block;
        }

        .logodiv {
            text-align: center;
        }

        .logodiv h1 {
            font-size: 1.4rem;
            color: #03357a;
            margin-top: 20px;
            margin-bottom: 20px;
        }

        .logodiv h2 {
            font-size: 1.5rem;
            margin-bottom: 80px;
        }



        .fgtpaws {
            text-align: center;
            margin-top: 10px;
        }

        .btn {
            padding: 0.375rem 0.15rem
        }

        .btn-tiqu {
            width: 125px;
            margin: 0 auto;
            display: block;
        }

        .buytitle {
            font-size: 1.1rem;
            color: #03357a;
            margin-top: 20px;
        }

        .buytitle span {
            font-size: 1rem;
            color: #999;
        }
        .action-row button {
            margin-bottom: 15px;
        }

        .buysearch {
            font-size: smaller;
        }

        .formscreen .form-control-theme {
            font-size: smaller;
        }

        .action-row {
            position: fixed;
            width: 100%;
            bottom: 0;
            margin-top: 0;
            margin-bottom: 0;
            background: #fff;
            left: 0;
        }

        .container2 {
            padding: 10px;
            display: block;
            overflow: hidden;
        }

        .bootstrap-select {
            width: calc(100% - 0px) !important;
        }

        .formscreen .filter-option-inner-inner {
            font-size: smaller;
        }

        .myselect {
            width: calc(100% - 0px);
        }

        .btn-action:disabled {
            background: #D9D9DA !important;
            color: #808081 !important;
        }

        .buysearch {
            width: 100%;
            display: block;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="container2">
            <div class="modal fade fullmodal show" style="display: block;" id="exampleModal"
                tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-body">
                            <div class="logodiv">
                                <img class="bannerlogo pt-3" src="../image/logo.jpeg">
                                <h3 class="mt-3 mb-5">{{lan['Customer_Shipment']}}</h3>
                            </div>
                            <div class="row  align-items-center">



                                <div class="col-12 col-sm-6 col-md-3">
                                    <div class="d-flex bd-highlight align-items-center">
                                        <div class="p-2 bd-highligh  flex-shrink-0 filedlabel">{{lan['Date']}}</div>
                                        <div class="p-2 flex-grow-1 bd-highlight">
                                            <input type="date" v-model="searchdata.ArrivedDate"
                                                :placeholder="lan['Date_placeholder']"
                                                class="form-control form-control-theme" value="">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-12 col-sm-6 col-md-3">
                                    <div class="d-flex bd-highlight align-items-center">
                                        <div class="p-2 bd-highligh flex-shrink-0 filedlabel">{{lan['SO_No']}}</div>
                                        <div class="p-2 flex-grow-1 bd-highlight">
                                            <input type="text" id="orderNum" v-model="searchdata.orderNum"
                                                :placeholder="lan['SO_No_placeholder']"
                                                class="form-control form-control-theme" value="">
                                        </div>
                                    </div>
                                </div>




                                <div class="col-12">
                                    <div class="d-flex bd-highlight align-items-center">
                                        <div class="p-2 bd-highligh flex-shrink-0 filedlabel">{{lan['User']}}</div>
                                        <div class="p-2 flex-grow-1 bd-highlight">
                                            <input type="text" v-model="searchdata.name" disabled
                                                class="form-control form-control-theme" value="">
                                        </div>
                                    </div>
                                </div>


                            </div>

                            <div class=" row justify-content-center mt-4">
                                <div class="col-4 col-md-4">
                                    <button type="button" onclick="loadData()" tapmode=""
                                        class="btn btn-primary btn-action">{{lan['OK']}}</button>
                                </div>


                                <div class="col-4 col-md-4">
                                    <button type="button" tapmode="" onclick="close_win()"
                                        class="btn btn-primary btn-action">{{lan['Cancel']}}</button>
                                </div>

                            </div>

                        </div>

                        <div class="modal-footer">
                            <div class="copyright">
                                <div class="row" :gutter="10">
                                    <div  class="col-5" style="text-align: right;">{{lan['Version']}}：</div>
                                    <div  class="col-7">{{appversion}}</div>
                                    <div  class="col-5"  style="text-align: right;">{{lan['Site']}}：</div>
                                    <div  class="col-7">{{SiteName}}</div>
                                    <div  class="col-5"  style="text-align: right;">{{lan['Company']}}：</div>
                                    <div  class="col-7">{{CompanyName}}</div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>

            <ul class="nav nav-tabs" id="myTab" role="tablist">
                <li class="nav-item" role="presentation">
                    <a class="nav-link active " id="home-tab" data-toggle="tab" href="#home" role="tab"
                        aria-controls="home" aria-selected="true">{{lan['SO_List']}}</a>
                </li>
                <li class="nav-item" role="presentation">
                    <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab"
                        aria-controls="profile" aria-selected="false">{{lan['Ship_List']}}</a>
                </li>

            </ul>
            <div class="tab-content" id="myTabContent">
                <div class="tab-pane  show active" id="home" role="tabpanel" aria-labelledby="home-tab">
                 
                    <table class="table table-buy table-borderless table-sm">
                        <tr>
                            <td class="ttl">{{lan['Date']}}</td>
                            <td class="ttl">{{lan['SO_No']}}</td>
                        </tr>
                        <tr>
                            <td> {{searchdata.ArrivedDate}}</td>
                            <td>  {{searchdata.orderNum}}</td>
                        </tr>
                    </table>
                    <h2 class="buytitle"><span>({{lan['Pls_select']}})</span></h2>
                    <button type="button" @click="list1_selectall()"
                    class="btn btn-link">{{lan['Select_All']}}</button>
                    <div  class="row align-items-center">
                        <div v-for="(item,k) in goodlist" :key="'shou'+k" v-if="item.shoucai == 1" id="shouitem"
                            class="col-12">
                            <div class="d-flex bd-highlight align-items-start">
                                <div class="pt-2 bd-highligh">
                                    <div class="custom-control custom-switch">
                                        <!-- 请选择 -->
                                        <input :disabled="Lot_btn"  type="checkbox" v-model='item.itemChecked' @change="toshou(item,k)" class="custom-control-input"
                                            :id="'Switch'+item.OrderRel_OrderNum+'-'+item.OrderRel_OrderLine +'-'+item.OrderRel_OrderRelNum">
                                        <label class="custom-control-label"
                                            :for="'Switch'+item.OrderRel_OrderNum+'-'+item.OrderRel_OrderLine+'-'+item.OrderRel_OrderRelNum"></label>
                                    </div>
                                </div>
                                <div class="pt-2 flex-grow-1 bd-highlight">
                                    <table class="table table-buy table-borderless table-sm">
                                        <tr>
                                            <td style="width: 80px;" class="ttl">{{lan['Line']}}</td>
                                            <td class="ttl">{{lan['Part']}}/{{lan['Desc']}}</td>
                                            <td class="ttl">{{lan['Order_Qty']}}</td>
                                            <td  class="ttl">{{lan['Delivered']}}</td>
                                        </tr>
                                        <tr>
                                            <td>{{item.OrderRel_OrderLine}}</td>
                                            <td>{{item.PartNum}}</td>
                                            <td>{{item.TotalQty}}</td>
                                            <td>{{item.IssuedQty}}</td>
                                        </tr>
                                        <tr>
                                            <td></td>
                                            <td colspan="3">{{item.PartDescription}}</td>
                                        </tr>
                                       
                                    </table>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
                <div class="tab-pane " id="profile" role="tabpanel" aria-labelledby="profile-tab">
                        
                    <table class="table table-buy table-borderless table-sm">
                        <tr>
                            <td class="ttl">{{lan['Date']}}</td>
                            <td class="ttl">{{lan['SO_No']}}</td>
                            <td class="ttl">From FMG</td>
                        </tr>
                        <tr>
                            <td> {{searchdata.ArrivedDate}}</td>
                            <td>  {{searchdata.orderNum}}</td>
                            <td> <input type="checkbox" :disabled="Lot_btn" @click="orderRelClick" v-model="searchdata.OrderRel_Make"   name="Make" id="Make"></td>
                        </tr>
                    </table>
                    <h2 class="buytitle"><span>({{lan['Cancel']}})</span></h2>
                    <button type="button" @click="list2_selectall()"
                    class="btn btn-link">{{lan['Un_Select_All']}}</button>
                    <div   class="row   align-items-center">
                        <div v-for="(item,k) in goodlist" :key="'cai'+k" v-if="item.shoucai == 2" id="caiitem"
                            class="col-12 col-sm-6 col-md-4">
                            <div class="d-flex bd-highlight align-items-start">
                                <div class="pt-2 bd-highligh">
                                    <div class="custom-control custom-switch">
                                        <!-- 请选择 -->
                                        <input :disabled="Lot_btn" type="checkbox" @change="toshou(item,k)" class="custom-control-input"
                                            :id="'Switch'+item.OrderRel_OrderNum+'-'+item.OrderRel_OrderLine+'-'+item.OrderRel_OrderRelNum">
                                        <label class="custom-control-label"
                                            :for="'Switch'+item.OrderRel_OrderNum+'-'+item.OrderRel_OrderLine+'-'+item.OrderRel_OrderRelNum"></label>
                                    </div>
                                </div>
                                <div class="pt-2 flex-grow-1 bd-highlight">
                                    <table class="table table-buy table-borderless table-sm">
                                        <tr>
                                            <td style="width: 80px;" class="ttl">{{lan['Line']}}</td>
                                            <td class="ttl">{{lan['Part']}}/{{lan['Desc']}}</td>
                                            <td class="ttl">{{lan['Order_Qty']}}</td>
                                            <td  class="ttl">{{lan['Delivered']}}</td>
                                        </tr>
                                        <tr>
                                            <td>{{item.OrderRel_OrderLine}}</td>
                                            <td>{{item.PartNum}}</td>
                                            <td>{{item.TotalQty}}<span>{{item.IUM}}</span></td>
                                            <td>{{item.IssuedQty}}</td>
                                            <td rowspan="3"><i v-if="!Lot_btn" @click="addPartChange(item,k)" class="iconfont icon-add"></i></td>
                                        </tr>
                                        <tr>
                                            <td></td>
                                            <td colspan="3">{{item.PartDescription}}</td>
                                        </tr>
                                    </table>
                                    <div v-if="goodlist[k].list.length > 0" >
                                            <div v-for="(item1,index1) in goodlist[k].list" :key="index1">
                                                <table  class="table table-buy table-borderless table-sm">
                                                    <tr  v-if="searchdata.OrderRel_Make">
                                                        <td colspan="4"  class="ttl">{{lan['Job_No']}}</td>
                                                    </tr>
                                                    <tr v-if="searchdata.OrderRel_Make">
                                                        <td style="width: 90%;" colspan="2">
                                                            <input  type="number"
                                                            :disabled="Lot_btn"
                                                            v-model="item1.JobNum"
                                                            class="form-control form-control-num" value="">
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="2"  class="ttl">{{lan['WareHouseCode']}}</td>
                                                        <td colspan="2" class="ttl">{{lan['BinNum']}}</td>
                                                    </tr>
                                                    <tr class="allinput">
                                                        <td style="width: 45%;" colspan="2">
                                                            <div class="wareContent">
                                                                <input   v-if="!item1.warehouseFlag" type="text"
                                                                :disabled = "Lot_btn"
                                                                v-model="goodlist[k].list[index1].WareHouseCode"
                                                                @click="warehouseFocus(item,k,item1,index1)"
                                                                class="form-control form-control-num" value="">
                                                                <select :disabled = "Lot_btn"  v-if="item1.warehouseFlag" @change="binNumChange(item,k,item1,index1)" v-model="goodlist[k].list[index1].WareHouseCode" 
                                                                    class="form-control"    data-live-search="true">
                                                                    <option v-for="(item2,index2) in item.WareHouseCodeList" :key="index2" 
                                                                        :value="item2.Warehse_WarehouseCode" :data-name="item2.Warehse_WarehouseCode">
                                                                        {{item2.Warehse_WarehouseCode}}</option>
                                                                </select>
                                                                <i v-if="!item1.warehouseFlag" style="margin-left: 5px;" @click="onWareQuery(item1,index1)" class="iconfont icon-scan"></i>
                                                                <i v-if="item1.warehouseFlag" style="margin-left: 5px;" @click="onWareScan(item1,index1)" class="iconfont icon-query"></i>
                                                            </div>
                                                        </td>
                                                        <td  colspan="2">
                                                            <div class="wareContent">
                                                                <input   v-if="!item1.binFlag" type="text"
                                                                @click="binFocus(item,k,item1,index1)"
                                                                :disabled = "Lot_btn"
                                                                v-model="goodlist[k].list[index1].BinNum"
                                                                class="form-control form-control-num" value="">
                                                                <select :disabled = "Lot_btn"  v-if="item1.binFlag"  @change="numChange(item,k,item1,index1)"   v-model="goodlist[k].list[index1].BinNum" 
                                                                    class="form-control" data-live-search="true">
                                                                    <option v-for="(item2,index2) in item1.BinNumList" :key="index2"  :value="item2.WhseBin_BinNum" >
                                                                        {{item2.WhseBin_BinNum}}
                                                                    </option>
                                                                </select>
                                                                <i  v-if="!item1.binFlag" style="margin-left: 5px;" @click="onBinQuery(item1,index1)" class="iconfont  icon-scan"></i>
                                                                <i  v-if="item1.binFlag" style="margin-left: 5px;" @click="onBinScan(item1,index1)" class="iconfont icon-query"></i>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td class="ttl">{{lan['Lot']}}</td>
                                                        <td class="ttl">{{lan['Qty']}}</td>
                                                        <td class="ttl"></td>
                                                        <td class="ttl">{{lan['On_Hand']}}</td>
                                                        <td  v-if="!Lot_btn" style="width:10%" rowspan="4"><i @click="removePartChange(item,k,item1,index1)" class="iconfont icon-delete"></i> </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <div class="wareContent">
                                                                <input  type="number"
                                                                v-if="item1.lotFlag"
                                                                @blur="lotBlur(item,k,item1,index1)"
                                                                :disabled="!item.Part_TrackLots || Lot_btn"
                                                                v-model="item1.LotNum"
                                                                class="form-control form-control-num" value="">
                                                                <input  type="number"
                                                                v-if="!item1.lotFlag"
                                                                :disabled="!item.Part_TrackLots || Lot_btn"
                                                                @click="lotFocus(item,k,item1,index1)"
                                                                v-model="item1.LotNum"
                                                                class="form-control form-control-num" value="">
                                                                <i  v-if="!item1.lotFlag" style="margin-left: 5px;" @click="onLotQuery(item1,index1)" class="iconfont  icon-scan"></i>
                                                                <i  v-if="item1.lotFlag" style="margin-left: 5px;" @click="onLotScan(item1,index1)" class="iconfont icon-query"></i>

                                                            </div>
                                                        </td>
                                                        <td style="display: flex;align-items: center;">
                                                            <input  type="number"
                                                            :disabled="Lot_btn"
                                                            @input="checkDecimal(item,k,item1,index1)"
                                                            @change="checkNum(item,k,item1,index1)" 
                                                            :step="item.AllowDecimals ? 'any' : '1'"
                                                            v-model="item1.OnhandQty"
                                                            class="form-control form-control-num" value="">
                                                            {{item.IUM}}
                                                        </td>
                                                       
                                                        <td>
                                                            <button style="width: 80px;" type="button" tapmode="" @click="toSerial(item,k,item1,index1)" :disabled="!item.Part_TrackSerialNum"
                                                                :class=" item.Part_TrackSerialNum == false ? 'btn-secondary':'btn-primary'"
                                                                class="btn btn-primary  btn-block">{{lan['Serial_No']}} <span
                                                                class="badge badge-light">{{item1.SerialNum.length}}</span>
                                                            </button>
                                                        </td>
                                                        <td>
                                                        <input  type="number"
                                                            disabled
                                                            v-model="item1.MaxQty"
                                                            class="form-control form-control-num" value="">
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                    </div>
                                </div>
                            </div>
                        </div>


                    </div>
                </div>
            </div>

        </div>

        <div style="height:100px;"></div>
        <div class="action-row">
            <div class="container">
                <div class=" row justify-content-center">
                  
                    <div class="col-4 col-md-3">
                        <button type="button"  tapmode="" onclick="scan()"
                            class="btn btn-primary btn-action">{{lan['Scan']}}
                        </button>
                    </div>
                    <div class="col-4 col-md-3">
                        <button type="button" tapmode="" :disabled="receipt_btn" onclick="checksubmit();"
                            class="btn btn-primary btn-action">{{lan['Comfirm']}}</button>
                    </div>

                    <div class="col-4 col-md-3">
                        <button type="button" tapmode="" onclick="close_win1();"
                            class="btn btn-primary btn-action">{{lan['Cancel']}}
                        </button>
                    </div>

                </div>

            </div>

        </div>
    </div>

</body>
<script type="text/javascript" src="../script/lang.js"></script>
<script type="text/javascript" src="../script/model.js"></script>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/vue.min.js"></script>
<script type="text/javascript" src="../script/jquery.min.js"></script>
<script type="text/javascript" src="../script/bootstrap.bundle.min.js"></script>
<script type="text/javascript" src="../script/bootstrap-select.min.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript">
    var postcount = 0;
    var returncount = 0;
    var postlist = [];
    var tagspostcount = 0;
    var tags = [];
    const app = new Vue({
        el: '#app',
        data: {
            list: [],
            goodlist: [],
            goodkeys: {},
            screenwidth: document.body.clientWidth,
            vendors: [],
            outinfo:"",
            inOutData:{},
            currentData:{},
            rowNum:1,
            requirenum: 0,
            scannum: 0,
            CustNum: 0,
            searchdata: {
                name: '',
                orderNum: '',//5425
                ArrivedDate: timenow(),
                AssemblySeq: '0',
                VendorName: '',
                OrderRel_Make:false,
            },
            uinfo: {},
            lotinfo: {},
            create_btn: false,
            receipt_btn: true,
            confirm_btn:false,
            Lot_btn:false,
            snsCheck:false,
            print_btn: true,
            print_num: '',
        },
        mounted() {
            const that = this
            window.onresize = () => {
                return (() => {
                    that.screenwidth = document.body.clientWidth
                })()
            }
            this.showmodal();

            setTimeout(function () {
                $("#orderNum").focus();
            }, 500);

            //init_select();
        },
        methods: {
            list1_selectall(){
                for (let i = 0; i < this.goodlist.length; i++) {
                    this.goodlist[i].shoucai = 2;
                }
            },
            list2_selectall(){
                for (let i = 0; i < this.goodlist.length; i++) {
                    this.goodlist[i].shoucai = 1;
                }
            },
            orderRelClick(){
                console.log(app.searchdata.OrderRel_Make,44444)
                  // 遍历goodlist数组
                this.goodlist.forEach(item => {
                    // 检查JobProd_JobNum是否为null
                    if (item.JobProd_JobNum !== null) {
                        // 如果app.searchdata.OrderRel_Make为true，则将list中所有对象的JobNum设置为JobProd_JobNum
                        if (app.searchdata.OrderRel_Make) {
                            item.list.forEach(listItem => {
                                listItem.JobNum = item.JobProd_JobNum;
                            });
                        }
                        // 如果app.searchdata.OrderRel_Make为false，则将list中所有对象的JobNum置为空字符串
                        else {
                            item.list.forEach(listItem => {
                                listItem.JobNum = "";
                            });
                        }
                    }else{
                        if (!app.searchdata.OrderRel_Make){
                            item.list.forEach(listItem => {
                                listItem.JobNum = "";
                            });
                        }
                    }
                });
            },
            checkDecimal(ite,k,item, index) {
                if(item.WarehouseCode == ""){
                    api.toast({
                        msg: lan['WareHouseCode_placeholder'],
                        location: 'middle'
                    });
                    item.OnhandQty=""
                    return;
                }
                if(item.BinNum == ""){
                    api.toast({
                        msg: lan['BinNum_placeholder'],
                        location: 'middle'
                    });
                    item.OnhandQty=""
                    return;
                }
                if(ite.Part_TrackLots && item.LotNum == ""){
                    api.toast({
                        msg: lan['LotNum_placeholder'],
                        location: 'middle'
                    });
                    item.OnhandQty=""
                    return;
                }
                // 获取输入的值
                let inputValue = item.OnhandQty;

                // 将输入值解析为浮点数
                let parsedValue = parseFloat(inputValue);

                // 如果解析成功，限制小数位数不超过 NumOfDec
                if (!isNaN(parsedValue)) {
                    const decimalCount = (inputValue.toString().split('.')[1] || "").length || 0;
                    if (decimalCount > item.NumOfDec) {
                    // 超过 NumOfDec 位小数，截取前 NumOfDec 位小数，不进行四舍五入
                    inputValue = inputValue.substring(0, inputValue.indexOf('.') + item.NumOfDec + 1);
                    }
                    item.OnhandQty = inputValue;
                    this.check_canclick()
                }
            },
            onWareQuery(item,index){
                item.warehouseFlag = true;
            },
            onWareScan(item,index){
                item.warehouseFlag = false;
            },
            onBinQuery(item,index){
                item.binFlag = true;
            },
            onBinScan(item,index){
                item.binFlag = false;
            },
            onLotQuery(item,index){
                item.lotFlag = true;
            },
            onLotScan(item,index){
                item.lotFlag = false;
            },
            addPartChange(item,k){
                loadWarehouseCodeData(item,k);
            },
            removePartChange(item,index,item1,index1){
                if (this.goodlist[index].list && this.goodlist[index].list.length > 0) {
                    this.goodlist[index].list.splice(index1, 1);
                    item.RowNum = item.RowNum - 1
                }
            },
            binNumChange:function(item,index,item1,index1){
                   
                setTimeout(function(){
                    loadBinData(item,index,item1,index1)
                },100)
                   
            },
            numChange:function(item,index,item1,index1){
                setTimeout(function(){
                    loadPartNumStatus(item,index,item1,index1)
                },100)
            },
            lotFocus:function(item,index,item1,index1){
                if(item.WarehouseCode == ""){
                    api.toast({
                        msg: lan['WareHouseCode_placeholder'],
                        location: 'middle'
                    });
                    return;
                }
                if(item.BinNum == ""){
                    api.toast({
                        msg: lan['BinNum_placeholder'],
                        location: 'middle'
                    });
                    return;
                }
                setTimeout(function(){
                    scan3(item,index,item1,index1)
                },100)
            },
            lotBlur:function(item,index,item1,index1){
                if(item.WarehouseCode == ""){
                    api.toast({
                        msg: lan['WareHouseCode_placeholder'],
                        location: 'middle'
                    });
                    return;
                }
                if(item.BinNum == ""){
                    api.toast({
                        msg: lan['BinNum_placeholder'],
                        location: 'middle'
                    });
                    return;
                }
                loadPartNumStatus(item,index,item1,index1)
            },
            warehouseFocus:function(item,index,item1,index1){
                setTimeout(function(){
                    scan1(item,index,item1,index1)
                },100)
            },
            binFocus:function(item,index,item1,index1){
                if(item.WarehouseCode == ""){
                    api.toast({
                        msg: lan['WareHouseCode_placeholder'],
                        location: 'middle'
                    });
                    return;
                }
                setTimeout(function(){
                    scan2(item,index,item1,index1)
                },100)
            },
            check_canclick: function () {
                var canclick = false;
                var tc = false;
                var sr = false;
                var tg = false;
                var sc = true;
                for (i in this.goodlist) {
                    if (this.goodlist[i].shoucai == 2) {
                        for(let i1 in this.goodlist[i].list){
                            let item =this.goodlist[i].list[i1]
                            if(item.OnhandQty == ""){
                                tg = true;
                            }
                            if (this.goodlist[i].is_SerialNum == 1) {
                                console.log(this.receipt_btn,22222)
                                if (item.SerialNum.length == 0) {
                                    sr = true;
                                }
                            }
                            if (this.goodlist[i].is_Lot == 1) {
                                if (!item.LotNum || item.LotNum == '') {
                                    tc = true;
                                }
                            }

                        }
                        sc = false;
                    }

                }
            
                if (tc  || tg  || sc || sr) {
                    canclick = true;
                }

                this.receipt_btn = canclick;
                console.log(this.receipt_btn,11111)
            },
            toshou: function (item,index) {
                var i = index;
                console.log(JSON.stringify(userinfo),222222)
                console.log(JSON.stringify(item),111111)
                var shoucai = this.goodlist[i].shoucai == 1 ? 2 : 1;
                if(shoucai == 2){
                    loadWarehouseCodeData(item,index)
                }
                console_debug(i, shoucai);
                var that = this;
                var unk = 0;
               
                // if (item.Calculated_ReceivedTo == "PUR-UKN") {
                //     unk = 1;
                //     that.$set(that.$data.goodlist[i], 'is_Lot', 2);
                //     that.$set(that.$data.goodlist[i], 'is_SerialNum', 2);
                // }
                if (that.goodlist[i].is_Lot != -1) {
                    setTimeout(function () {
                        that.$set(that.$data.goodlist[i], 'shoucai', shoucai);
                       
                    }, 500)
                    if(item.shoucai == 1){
                        that.$set(that.$data.goodlist[i], 'list', []);
                        item.itemChecked = false;
                    }
                    return;
                }
               

            },
          
            toSerial: function (item, index,item1,index1) {
                if(!item1.OnhandQty){
                    api.toast({
                        msg: lan['palase_enter'] + lan['Qty'],
                        location: 'middle'
                    });
                    return
                }
                var data = {};
                if(item1.OnhandQty != item1.OldQty){
                    item1.SerialNum = []
                }
                item1.PartNum = item.PartNum;
                item1.PartDescription = item.PartDescription;
                var InputOurQty = processNumber(item1.OnhandQty, item.NumOfDec);
                if(item1.SerialNum.length==0 ){
                    for (let i = 0; i < InputOurQty; i++) {
                        item1.SerialNum.push({
                            'type': i+1,
                            'SerialNumber': '',
                        })
                    }
                }
                data.post = item1;
                data.index = index;
                data.index1 = index1;
                data.post.Lot_btn = app.Lot_btn;
                data.post.snsCheck = app.snsCheck
                data.post.index = index;
                data.post.index1 = index1;
                data.searchdata = this.searchdata;
                data.title = lan['Customer_Shipment'];
                data.frame = "sn_deliver_products";
                data.right = [{
                    text: lan["Scan"],
                    color: '#fff',
                }];
                console_debug(data,"sn_deliver_products");

                openNavWin2(data.frame, data);

            },
            checkNum: function (item, index,item1,index1) {
                var OnhandQty = processNumber(this.goodlist[index].list[index1].OnhandQty,this.goodlist[index].NumOfDec);
                if (OnhandQty <= 0) {
                    OnhandQty = 1;

                }
                this.$set(this.$data.goodlist[index].list[index1], 'OnhandQty', OnhandQty);
            },
            showmodal: function () {
                if (this.screenwidth < 576) {
                    $('#exampleModal').modal('show');
                    //init_select();
                } else {

                    $('#JobNum').focus();
                }
            },
            hidemodal: function () {
                $('#exampleModal').modal('hide');
            },
        }
    });
    apiready = function () {
        api.parseTapmode();
        server = getapi();
        back_listen();
        app.vendors = get_prefs_data("Vendors");
        app.uinfo = get_user_info();
        userinfo = get_user_info();
        app.searchdata.name = userinfo.Name;
        api.addEventListener({
            name: 'infrared_scanning'
        }, function (ret, err) {
            console.log(JSON.stringify(ret));
            $("input:focus").val(ret.value.str);
            app.searchdata.orderNum =  $("#orderNum").val();
            
            if (ret && ret.value && ret.value.str && is_scan == 0) {
                app.searchdata.orderNum = ret.value.str;
            }

        });
        api.addEventListener({
            name: 'keyback',
            extra: {
                slidBackIntercept: true    
            }
        }, function (ret, err) {
            if(app.confirm_btn){
                close_win1()  
                app.confirm_btn = false
            }else{
                close_win()
            }   

        });


        api.addEventListener({
            name: 'sn_deliver_products'
        }, function (ret, err) {
            if(ret && ret.value){
                var snposts = ret.value;
                console.log(JSON.stringify(snposts),33333)
                app.goodlist[snposts.index].list[snposts.index1].OnhandQty = snposts.OnhandQty;
                app.goodlist[snposts.index].list[snposts.index1].OldQty = snposts.OldQty;
                app.goodlist[snposts.index].list[snposts.index1].SerialNum = snposts.SerialNum;
                app.check_canclick()
                console.log(JSON.stringify(app.goodlist),44444)
                api.closeWin({name: 'sn_deliver_products'});
            }
        });
        api.addEventListener({ name: 'navitembtn' }, function (ret, err) {
            if(ret.type == 'left'){
                if(app.confirm_btn){
                    close_win1()  
                    app.confirm_btn = false
                }else{
                    close_win()
                }
               
            }
            if (ret.type == 'right') { 
                scan()
            }
        });

    }
     //关闭取消事件
     function close_win1() {
        var msg = app.receipt_btn && app.goodlist.length != 0 ? lan['deliver__cancel_tips'] : lan['deliver__cancel_tips'];
        if(app.confirm_btn && app.goodlist.length != 0){
            api.confirm({
                title: lan['Tips'],
                msg: msg,
                buttons: [lan['NO'], lan['YES'], lan['Cancel']]
            }, function (ret, err) {
                var index = ret.buttonIndex;
                if (index == 2) {
                    checksubmit();
                } else if (index == 1) {
                    close_win();
                }
            });
        }else{
            close_win();
        }

    }
    function scan1(item,index,item1,index1){
        var FNScanner = api.require('FNScanner');
        FNScanner.open({
            autorotation: true
        }, function (ret, err) {
            console_debug(ret, err);
            if (ret) {
                if (ret.eventType == 'success') {
                    app.$set(app.$data.goodlist[index].list[index1],'WareHouseCode',ret.content)
                    setTimeout(function(){
                        loadBinData(item,index,item1,index1)
                    },300)
                }
            } 
        });
          
    }
    function scan2(item,index,item1,index1){
        var FNScanner = api.require('FNScanner');
        FNScanner.open({
            autorotation: true
        }, function (ret, err) {
            console_debug(ret, err);
            if (ret) {
                if (ret.eventType == 'success') {
                    app.$set(app.$data.goodlist[index].list[index1],'BinNum',ret.content)
                    setTimeout(function(){
                        loadPartNumStatus(item,index,item1,index1)
                    },300)
                }
            } 
        });
          
    }
    function scan3(item,index,item1,index1){
        var FNScanner = api.require('FNScanner');
        FNScanner.open({
            autorotation: true
        }, function (ret, err) {
            console_debug(ret, err);
            if (ret) {
                if (ret.eventType == 'success') {
                    app.$set(app.$data.goodlist[index].list[index1],'LotNum',ret.content)
                    setTimeout(function(){
                        loadPartNumStatus(item,index,item1,index1)
                    },300)
                }
            } 
        });
          
    }

    function scan() {

        var FNScanner = api.require('FNScanner');
        FNScanner.open({
            autorotation: true
        }, function (ret, err) {
            console_debug(ret, err);
            if (ret) {
                if (ret.eventType == 'success') {
                    app.outinfo = ret.content
                    if(!app.confirm_btn){
                        app.searchdata.orderNum = ret.content;
                    }
                    
                }

            } else {
                //alert(JSON.stringify(err));
            }
        });
    }
  
    async function loadWarehouseCodeData(data,k) {
        userinfo = get_user_info();
        if (!userinfo.Token) {
            return;
        }
        await api.ajax({
            url: server + 'BaqSvc/WMS_WarehouseForPart/?CompID=' + userinfo.Company + "&Site=" + userinfo.Site +"&PartNum="+data.PartNum,
            method: 'get',
            returnAll: false,
            headers: {
                'Authorization': userinfo.Token,
            },
            data: {}
        }, function (ret, err) {
            console.log(JSON.stringify(ret), 22222)
            if (ret && ret.value.length > 0) {
               if(data.shoucai == 2){
                    app.$set(app.$data.goodlist[k],'WareHouseCodeList',ret.value)
                    const item = itemdata({});
                    if(data.PlantConfCtrl_DefShipWhse!=null){
                        item.WareHouseCode = data.PlantConfCtrl_DefShipWhse
                    }
                    if(data.PlantConfCtrl_DefShipWhse!=null){
                        item.BinNum = data.PlantConfCtrl_DefShipBin
                    }
                    if(data.JobProd_JobNum!=null){
                        app.searchdata.OrderRel_Make = true
                        item.JobNum = data.JobProd_JobNum
                    }
                    app.goodlist[k].list.push(item);
                    console.log(JSON.stringify(app.goodlist),44444)
                    const bacth =localStorage.getItem('batch')
                    if(bacth == 0){
                        firstOnhandData(app.goodlist[k],k,app.goodlist[k].list[data.RowNum-1],data.RowNum-1)
                        data.RowNum = data.RowNum + 1
                    }
                }
            }
        });
    }
    async function loadBinData(item,index,item1,index1) {
        userinfo = get_user_info();
        $('.myselect4').selectpicker('destroy'); // 先销毁
        await api.ajax({
            url: server + 'BaqSvc/WMS_WhseBin/?CompID=' + userinfo.Company + "&WarehouseCode=" + item1.WareHouseCode,
            method: 'get',
            returnAll: false,
            headers: {
                'Authorization': userinfo.Token,
            },
            data: {

            }
        }, function (ret, err) {
            if (ret && ret.value.length > 0) {
               app.$set(app.$data.goodlist[index].list[index1],'BinNumList',ret.value)
                setTimeout(function () {
                    app.check_canclick()
                }, 200)
            }

        });
    }
    function loadPartNumStatus(item,index,item1,index1){
        userinfo = get_user_info();
        let filter = "?CompID=" + userinfo.Company;
        if (item.PartNum) {
            filter += "&PartNum=" + item.PartNum;
        }
        if(item1.WareHouseCode){
            filter += "&WhseCode=" + item1.WareHouseCode;
        }
        if(item1.BinNum){
            filter += "&Bin=" + item1.BinNum;
        }
        if(item1.LotNum){
            filter += "&LotNum=" + item1.LotNum;
        }
        api.ajax({
            url: server + 'BaqSvc/WMS_PartBinOnhand/' + filter,
            method: 'get',
            returnAll: false,
            headers: {
                'Authorization': userinfo.Token,
            },
            data: {} 
        },function(ret,err){
            console.log(filter,44444)
            console.log(JSON.stringify(ret),111111)
            console.log(JSON.stringify(err),222222)
            if(ret && ret.value.length>0){
                app.check_canclick()
                if(item.Part_TrackLots && item1.LotNum != ""){
                    app.$set(app.$data.goodlist[index].list[index1],'MaxQty',processNumber(ret.value[0].PartBin_OnhandQty,item.NumOfDec)) 
                }
                if(!item.Part_TrackLots){
                    app.$set(app.$data.goodlist[index].list[index1],'MaxQty',processNumber(ret.value[0].PartBin_OnhandQty,item.NumOfDec))   
                }    
            }
        })
    }   
   
    function loadData() {

        userinfo = get_user_info();
        //console_debug(filter, '');
        showProgress(lan['Loading']);
        api.ajax({
            url: server + 'BaqSvc/WMS_SOForShip/?CompID='+ userinfo.Company + "&Site=" + userinfo.Site +'&OrderNum='+app.searchdata.orderNum,
            method: 'get',
            returnAll: false,
            headers: {
                'Authorization': userinfo.Token,
            },
            data: {},
        }, function (ret, err) {
            ajaxing = 0;
            console.log(JSON.stringify(ret.value),99999)
            hideProgress();
            if (ret && ret.value.length > 0) {
                app.CustNum = ret.value[0].Customer_CustNum;
                var newlist = init_list(ret.value);
                if (newlist.length == 0) {
                    api.toast({
                        msg: "no data!",
                        location: 'middle'
                    });
                    return;
                }

                // PartNumTrackSerialNum

                app.goodlist = [];
                app.requirenum = 0;
                app.goodlist = app.goodlist.concat(newlist);
                console.log(JSON.stringify(app.goodlist),44444)
                app.confirm_btn = true
                $('#exampleModal').modal('hide');

            } else {
                api.toast({
                    msg: "no data!",
                    location: 'middle'
                });
            }

        });
    }
    //JobMtl
    function init_list(data) {
        var ret = [];
        for (i in data) {
            data[i].PartNum = data[i].OrderDtl_PartNum;
            data[i].PartDescription = data[i].OrderDtl_LineDesc;
            data[i].NumOfDec = data[i].UOM_NumOfDec;
            data[i].IUM = data[i].OrderRel_IUM
            data[i].WareHouseCodeList = [];
            data[i].shoucai = 1;
            data[i].itemChecked = false;
            data[i].OnhandQty = "";
            data[i].is_Lot = -1; //批号判断 -1 未查询  1 需创建 2 不需创建
            data[i].is_SerialNum = -1; //序列号判断 -1 未查询  1 需创建 2 不需创建
            if (data[i].Part_TrackLots) {
                data[i].is_Lot = 1
            } else {
                data[i].is_Lot = 2
            }
            if (data[i].Part_TrackSerialNum) {
                data[i].is_SerialNum = 1; 
            } else {
                data[i].is_SerialNum = 2; 
            }
            data[i].RowNum = 1;
            data[i].list = []
            data[i].TotalQty = processNumber(data[i].OrderRel_OurReqQty,data[i].UOM_NumOfDec);
            data[i].IssuedQty = processNumber(data[i].Calculated_ShippedQty,data[i].UOM_NumOfDec);
            ret.push(data[i]);

        }
        return ret;
    }
    function itemdata(data){
        data.WareHouseCode='';
        data.BinNum='';
        data.MaxQty=0;
        data.LotNum='';
        data.OnhandQty='';
        data.OldQty='';
        data.SerialNum=[];
        data.BinNumList = [];
        data.warehouseFlag=false;
        data.binFlag=false;
        data.lotFlag=false;
        data.JobNum = "";
        return data
    }

    function firstOnhandData(item,index,item1,index1){
        userinfo = get_user_info();
        var filter = "?CompID=" + userinfo.Company;
        filter += "&PartNum=" + item.PartNum;
        filter += "&RowNum=" + item.RowNum;
        console.log(JSON.stringify(filter),22222)
        api.ajax({
            url: server + 'BaqSvc/WMS_FirstLot/' + filter,
            method: 'get',
            returnAll: false,
            headers: {
                'Authorization': userinfo.Token,
            },
            data: {}  
        }, function (ret, err) {
            ajaxing = 0;
            is_scan = 0;
            console.log(JSON.stringify(ret),66666)
            hideProgress();
            if (ret && ret.value.length>0) {
                app.check_canclick()
                app.$set(app.$data.goodlist[index].list[index1],'MaxQty',processNumber(ret.value[0].PartBin_OnhandQty,item.NumOfDec)) 
                app.$set(app.$data.goodlist[index].list[index1],'LotNum',ret.value[0].PartBin_LotNum)
                app.$set(app.$data.goodlist[index].list[index1],'WareHouseCode',ret.value[0].PartBin_WarehouseCode)
                app.$set(app.$data.goodlist[index].list[index1],'BinNum',ret.value[0].PartBin_BinNum)
            }
        })
    }


    function getvendorName(ob) {
        console_debug(app.searchdata);
        var vname = $('#vendorselect option:selected').attr("data-name");
        app.searchdata.VendorName = vname;
    }

    function checksubmit() {
        let hasNegativeQty = false;

        for (let i = 0; i < app.goodlist.length; i++) {
            const item = app.goodlist[i];
            if (
            item.shoucai === 2 &&
            item.PartClass_NegQtyAction === "Stop" &&
            item.list.length > 0
            ) {
            for (let j = 0; j < item.list.length; j++) {
                const listItem = item.list[j];
                if(app.searchdata.OrderRel_Make && !listItem.JobNum){
                    api.toast({
                        msg:lan['Job_No_placeholder'],
                        location: 'middle'
                    })
                    return
                }
                if (processNumber(listItem.OnhandQty,item.NumOfDec) > processNumber(listItem.MaxQty,item.NumOfDec)) {
                    const message = `Order: ${item.OrderRel_OrderNum}, Line: ${item.OrderRel_OrderLine}. Part: ${item.PartNum}. Warehouse: ${listItem.WareHouseCode}. Bin: ${listItem.BinNum}. This transaction will result in a negative onhand quantity for the bin.`;
                    api.confirm({
                        title: lan["Tips"],
                        msg: message,
                        buttons: ["", lan["YES"]],
                    },function (ret, err) {
                        // 用户点击了 "YES"，继续提交数据或执行相应的操作
                        // 在这里编写用户点击 "YES" 后的处理逻辑
                        });
                    hasNegativeQty = true;
                    break; // 提示一次后停止继续检查
                }
            }
            }
        }

        if (!hasNegativeQty) {
            for (let i = 0; i < app.goodlist.length; i++) {
                const item = app.goodlist[i];
                if (item.shoucai === 2 && item.PartClass_NegQtyAction === "Warn" && item.list.length > 0) {
                    for (let j = 0; j < item.list.length; j++) {
                        const listItem = item.list[j];
                        if(app.searchdata.OrderRel_Make && !listItem.JobNum){
                            api.toast({
                                msg:lan['Job_No_placeholder'],
                                location: 'middle'
                            })
                            return
                        }
                        if (processNumber(listItem.OnhandQty,item.NumOfDec) > processNumber(listItem.MaxQty,item.NumOfDec)) {
                            const message = `This transaction will result in a negative onhand quantity for Part: ${item.PartNum}, Bin: ${listItem.BinNum}. Do you want to continue?`;
                            api.confirm(
                            {
                                title: lan["Tips"],
                                msg: message,
                                buttons: [lan["NO"], lan["YES"], lan["Cancel"]],
                            },
                            function (ret, err) {
                                var index = ret.buttonIndex;
                                if (index === 2) {
                                    submitfrom();
                                    // 用户点击了 "YES"，继续提交数据或执行相应的操作
                                    // 在这里编写用户点击 "YES" 后的处理逻辑
                                } else if (index === 1) {
                                    // close_win();
                                    // 用户点击了 "NO"，返回原页面或执行相应的操作
                                    // 在这里编写用户点击 "NO" 后的处理逻辑
                                }
                            }
                            );
                            return; // 提示一次后停止继续检查
                        }
                    }
                }
            }

            submitfrom();
        }
    }
   
    function submitfrom() {
        console.log(JSON.stringify(app.goodlist),999999)
        // return
        var postlist = [];
        for (i in app.goodlist) {
            var item = app.goodlist[i];
            if(item.shoucai == 2){
                for(i1 in item.list){
                    let item1 = item.list[i1]
                    if(app.searchdata.OrderRel_Make && !item1.JobNum){
                        api.toast({
                            msg:lan['Job_No_placeholder'],
                            location: 'middle'
                        })
                        return
                    }
                    app.goodlist[i].OrderRelNum = item.OrderRel_OrderRelNum;
                    app.goodlist[i].OrderLine = item.OrderRel_OrderLine;
                    app.goodlist[i].OrderNum = parseInt(app.searchdata.orderNum);
                    var row = {
                        "ShipPerson": userinfo.Name,     //-- 出货人 （使用用户名 登陆界面选择的内容）
                        "CustNum": app.CustNum,			//	-- 客户编号
                        "OrderNum": parseInt(app.searchdata.orderNum),		//	--订单号
                        "OrderLine": item.OrderLine,			//	--订单行
                        "OrderRelNum": item.OrderRelNum,		//	--订单发货行
                        "ShipQty": item1.OnhandQty,			//	--出货数量
                        "PartNum": item.PartNum,		//--物料编号
                        "ShipDate": app.searchdata.ArrivedDate,//	--出货日期
                        "LineDesc": item.PartDescription,		//--物料描述
                        "IUM": item.IUM,				//--单位
                        "WarehouseCode": item1.WareHouseCode,	//--出货仓库
                        "BinNum": item1.BinNum,	//	--出货仓位
                        "LotNum": item1.LotNum,				//--批号
                        "JobNum":item1.JobNum
                    }

                    var arr = [];
                    if(item1.SerialNum){
                        if(item1.SerialNum.length>0){
                            var SerialNum = item1.SerialNum;
                            for(k in SerialNum){
                                var row1 = {};
                                row1.SerialNumber = SerialNum[k].SerialNumber;
                                arr.push(row1);  
                            }
                        }
                    }
                    if(arr.length>0){
                        row.SelectedSerialNumbers = arr;
                    }
                    postlist.push(row);
                }
            }

        }
        if (!postlist) {
            api.toast({
                msg: lan['No_Data_Submit'],
                location: 'middle'
            });
            return;
        }
        console.log(JSON.stringify(postlist),222222)
        var datalist = {};
        for (i in postlist) {
            var item = get_new_arr(postlist[i]);
            var key = item.PartNum + item.OrderLine + item.OrderRelNum + item.WareHouseCode + item.BinNum + item.LotNum;
            if (datalist[key]) {
                datalist[key].ShipQty = datalist[key].ShipQty + item.ShipQty;
                if (datalist[key].SelectedSerialNumbers) {
                    datalist[key].SelectedSerialNumbers = datalist[key].SelectedSerialNumbers.concat(item.SelectedSerialNumbers);
                } else {
                    datalist[key].SelectedSerialNumbers = item.SelectedSerialNumbers;
                }
            } else {
                datalist[key] = item;
            }
        }
        var postrows = [];
        for (key in datalist) {
            postrows.push(datalist[key]);
        }
        var data1 = {
            "CompanyID": userinfo.Company,
            "PlantID": userinfo.Site,
            "UserName": userinfo.Name,
            "Password": userinfo.password,
            "Data": JSON.stringify(postrows)
        }

        console_debug(data1,"提交数据");
        // return;


        if(ajaxing){return;}showProgress(lan['Loading']);


        submit_custship(data1);
       
    }

    function submit_custship(item) {

        api.ajax({
            url: wmsserver + 'custship/',
            method: 'post',
            returnAll: false,
            headers: {
                'token': wmstoken,
                'Content-Type': 'application/json;charset=utf-8'
            },
            //dataType: 'text',
            data: {
                body: create_submit_data(item)
            }
            //data: {values: data1}
        }, function (ret, err) {
            ajaxing = 0;
            console_debug(ret, err);
            // console.log(err,444444)
            if (ret && ret.code == 1) {
                api.alert({
                    title: lan['Tips'],
                    msg: lan['Submitted_successfully']
                }, function (ret, err) {
                    app.receipt_btn = true
                    for(let i in app.goodlist){
                        app.goodlist[i].RowNum = 1
                    }
                    app.confirm_btn = false
                    app.Lot_btn = true
                    hideProgress();
                });
            } else {
                // console.log(JSON.stringify(ret),55555)
                app.receipt_btn = true
                hideProgress();
                errMassage(ret.msg)
            }

        });
    }
  
</script>

</html>